package net.xdclass.controller;

import net.xdclass.service.ProductService;
import net.xdclass.util.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 二当家小D
 * @since 2025-09-19
 */
@RestController
@RequestMapping("/productDO")
public class ProductController {
	@Autowired
	private ProductService productService;

	@GetMapping("list")
	public JsonData list() {
		return JsonData.buildSuccess(productService.list());}


		@GetMapping("detail/{product_id}")
		public JsonData detail (@PathVariable("product_id") Long product_id){
			return JsonData.buildSuccess(productService.detail(product_id));
		}
}

